1. /* slmrwput.cpp by K.Tsuru */
  2. // function ID = 217 DRADIX, BRADIX
  3. /***************************
  4. SLong and SInteger classes
  5. output in raw representation
  6. ****************************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. long SLong::RawPut(int crlf) const{
  11. long cCount = 0;
  12. int p = (int)(Size()-1);
  13. int nc = 0; //the number of digits and delimters per line
  14. const int width = (Radix() == DRADIX) ? DFIGURES : BFIGURES;
  15. int nl = displayWidth/(width+1); //the number per line
  16. FILE* out = FileStream();
  17. //output negative sign
  18. if(RawSign() == -1 ){ putc('-', out); cCount++; }
  19. else if(RawSign() == -1 ){
  20. putc('*', out); cCount++;
  21. if(Size()==0) return cCount;
  22. }
  23. for( ; p >= 0; p--){
  24. // cCount += fprintf(out, "%0*"fTypeFormat, width, figure(p));
  25. cCount += fprintf(out, "%0*" fTypeFormat, width, figure(p)); // for c++11
  26. nc++;
  27. if(nc == nl){ putc('\n', out); nc = 0;
  28. } else putc(' ', out);
  29. cCount++;
  30. }
  31. char buff[100];
  32. sprintf(buff, "(size = %u, head = %u, tail = %u)", Size(), aHead, aTail);
  33. if( displayWidth - nc*(width+1) < strlen(buff) ){
  34. putc('\n', out); cCount++;
  35. }
  36. cCount += fprintf(out, "%s", buff);
  37. if(crlf){ putc('\n', out); cCount++; }
  38. return cCount;
  39. }

slmrwput.cpp : last modifiled at 2017/07/17 15:28:16(1,246 bytes)
created at 2017/10/07 10:26:48
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).